package model

var RepositoryNames = struct { // repositories
	Banner         string
	BackendMedia   string
	SearchKeyword  string
	Section        string
	SectionProduct string
	SectionPost    string
}{
	Banner:         "Banner",
	BackendMedia:   "BackendMedia",
	SearchKeyword:  "SearchKeyword",
	Section:        "Section",
	SectionProduct: "SectionProduct",
	SectionPost:    "SectionPost",
}

var RepositoryPreloadMap = map[string]map[string]string{
	RepositoryNames.Banner: {
		"Id":        BannerColumns.ID,
		"Title":     BannerColumns.Title,
		"Type":      BannerColumns.Type,
		"LinkType":  BannerColumns.LinkType,
		"LinkUrl":   BannerColumns.LinkURL,
		"AdType":    BannerColumns.ObjectType,
		"AdId":      BannerColumns.ObjectID,
		"PicUrl":    BannerColumns.PicURL,
		"Sort":      BannerColumns.Sort,
		"Status":    BannerColumns.Status,
		"CreatedAt": BannerColumns.CreatedAt,
		"UpdatedAt": BannerColumns.UpdatedAt,
		"StartedAt": BannerColumns.StartedAt,
		"EndedAt":   BannerColumns.EndedAt,
	},
	RepositoryNames.BackendMedia: {
		"Uid":          AttachmentRelationshipColumns.RelationshipID,
		"ObjectId":     AttachmentRelationshipColumns.ObjectID,
		"ObjectType":   AttachmentRelationshipColumns.ObjectType,
		"Id":           AttachmentRelationshipColumns.AttachmentID,
		"Thumbnail":    AttachmentRelationshipColumns.AttachmentThumbnail,
		"Order":        AttachmentRelationshipColumns.AttachmentOrder,
		"Uri":          AttachmentRelationshipColumns.AttachmentImageSource,
		"Url":          AttachmentRelationshipColumns.AttachmentImageURL,
		"altText":      AttachmentRelationshipColumns.AttachmentImageAlt,
		"sourceUrl":    AttachmentRelationshipColumns.AttachmentImageSource,
		"mediaDetails": AttachmentRelationshipColumns.AttachmentImageMeta,
	},
	RepositoryNames.SearchKeyword: {
		"Id":         SearchKeywordColumns.ID,
		"Type":       SearchKeywordColumns.Type,
		"Title":      SearchKeywordColumns.Title,
		"Sort":       SearchKeywordColumns.Sort,
		"ObjectId":   SearchKeywordColumns.ObjectID,
		"ObjectType": SearchKeywordColumns.ObjectType,
		"LinkType":   SearchKeywordColumns.LinkType,
		"LinkUrl":    SearchKeywordColumns.LinkURL,
		"Status":     SearchKeywordColumns.Status,
		"StartedAt":  SearchKeywordColumns.StartedAt,
		"EndedAt":    SearchKeywordColumns.EndedAt,
		"CreatedAt":  SearchKeywordColumns.CreatedAt,
		"UpdatedAt":  SearchKeywordColumns.UpdatedAt,
	},
	RepositoryNames.Section: {
		"Id":        SectionColumns.ID,
		"Type":      SectionColumns.Type,
		"Title":     SectionColumns.Title,
		"Subtitle":  SectionColumns.Subtitle,
		"PicId":     SectionColumns.PicID,
		"PicUrl":    SectionColumns.PicURL,
		"Sort":      SectionColumns.Sort,
		"Status":    SectionColumns.Status,
		"CreatedAt": SectionColumns.CreatedAt,
		"UpdatedAt": SectionColumns.UpdatedAt,
		"StartedAt": SectionColumns.StartedAt,
		"EndedAt":   SectionColumns.EndedAt,
	},
	RepositoryNames.SectionProduct: {
		"Id":         SectionProductRelationshipColumns.RelationshipID,
		"SectionId":  SectionProductRelationshipColumns.SectionID,
		"BrandId":    SectionProductRelationshipColumns.BrandID,
		"CategoryId": SectionProductRelationshipColumns.CategoryID,
		"ProductId":  SectionProductRelationshipColumns.ProductID,
		"Sort":       SectionProductRelationshipColumns.Sort,
	},
	RepositoryNames.SectionPost: {
		"Id":        SectionPostRelationshipColumns.RelationshipID,
		"SectionId": SectionPostRelationshipColumns.SectionID,
		"PostId":    SectionPostRelationshipColumns.PostID,
		"PostType":  SectionPostRelationshipColumns.PostType,
		"Sort":      SectionPostRelationshipColumns.Sort,
	},
}

var RpcEntityNames = struct { // rpc entities
	Banner         string
	BackendMedia   string
	SearchKeyword  string
	Section        string
	SectionProduct string
	SectionPost    string
}{
	Banner:         "banner",
	BackendMedia:   "backendMedia",
	SearchKeyword:  "searchKeyword",
	Section:        "section",
	SectionProduct: "sectionProduct",
	SectionPost:    "sectionPost",
}

type ColumnSetting struct {
	Name          string // rpc column name
	RpcEntityName string // sqlboiler repository name
}

var RpcEntityPreloadMap = map[string]map[string]*ColumnSetting{
	RpcEntityNames.Banner:         {},
	RpcEntityNames.BackendMedia:   {},
	RpcEntityNames.SearchKeyword:  {},
	RpcEntityNames.Section:        {},
	RpcEntityNames.SectionProduct: {},
	RpcEntityNames.SectionPost:    {},
}
